<?xml version="1.0" encoding="utf-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>员工信息</title>
		<!-- 引入样式 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<script src="https://unpkg.com/vue/dist/vue.js"></script>
		<!-- 引入组件库 -->
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
		<!-- 引入axios -->
		<script src="../js/axios.js"></script>
		<script src="../js/qs.js"></script>
		<!-- 导入jquery -->
		<script src="../js/jquery.min.js"></script>
		<style type="text/css">
.loading{
        width: 100%;
        height: 100%;
        position: fixed;
        background-color: white;
        top: 0px;
        left: 0px;
        z-index: 100;
}	
.loading .bigpic{
    width: 104px;
    height: 104px;
    background-image: url("../imgs/loading.gif") ;
    position: absolute;
    top: 0px;
    bottom: 0px;
    right: 0px;
    left: 0px;
    margin: auto;
}

		</style>
<script>
	document.addEventListener("readystatechange",function(){
		//对象尚未初始化
		if(document.readyState=="uninitialized"){
			console.log("readystatechange-uninitialized");
		}
		//对象正在加载
		if(document.readyState=="loading"){
			console.log("readystatechange-loading");
		}
		//对象加载数据完成
		if(document.readyState=="loaded"){
			console.log("readystatechange-loaded");
		}
		//可以操作对象，但还没完全加载
		if(document.readyState=="interactive"){
			console.log("readystatechange-interactive");
		}
		//对象已经加载完毕
	     if (document.readyState == "complete") {
	       console.log("readystatechange-complete");
	      }
	  });
	$(function(){
	    //读取数据是否加载成功
	    document.onreadystatechange=function(){
	        //判断页面读取状态   页面读取状态一共四中
	        if(document.readyState == "complete"){
	        //载入完成fadeOut();移除div样式
	            $(".loading").fadeOut();
	        }
	    }
	});
</script>
	</head>
	<body>
		<!-- 搜索 -->
		<div class="loading">
			<div class="bigpic"><div class="bigpic"></div></div>
		</div>
		<div id="bigbox" >
			 <div style="width: 100%;margin-left: 15px;display: block;" > 
				<i class="el-icon-caret-right" style="line-height: 40px;margin-right: 5px; float: left;"></i>
				<template style="margin-top: 50px;">
  			<el-select v-model="value7" placeholder="请选择" style="float: left;width: 120px; height: 60px;" @change="handleSelect">
    		<el-option-group v-for="group in options3" :key="group.label" :label="group.label" >
      		<el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.value">
     		 </el-option>
    		</el-option-group>
 			 </el-select>
				</template>
				<i class="el-icon-search" style="line-height: 40px;float: left;margin-left: 10px; width: 50px; height: 50px;"></i>
				<!-- 搜索框 -->
				<div style="display: block;margin-left: -20px;float: left;">
					<el-input style="width:250px;" placeholder=" " v-model="pdID">
						<template slot="append" style="width: 100px;">员工信息编号</template>
					</el-input>
				</div>
				<!-- 表单 -->
			<div style="width: 99%;float: left;" id="app2">
				<div style="float: left;margin-left: 30px;margin-top: -10px;">
					<p style="font-size: 13px;color: #333333;">员工列表</p>
				</div>
				<div style="float: right;display: block;margin-right: 20px;margin-top: -10px;">
					<!-- 新建员工信息 -->
					<el-button size="small" icon="el-icon-circle-plus" v-on:click="loadInfo(0)" @click="dialogFormVisible = true" style="width: 80px;"> 新建</el-button>
					<!-- 这里是弹窗--start-->					
					<el-dialog   title="新建员工" :visible.sync="dialogFormVisible" width="70%" fullscreen >
						<hr style="border: 1px solid #000000;margin-top: -15px;" />
						<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">员工</p>
						<hr style="border: 0.5px solid #EEEEEE;" />
				
						<el-form :model="form" :rules="rules" label-width="150px" ref="form" style="height: 1000px; margin-top: 20px;" >
							<el-row style="margin-left: -75px;">
								<el-col :span="12">
									<el-form-item label="用户名" prop="uName">
										<el-input v-model="form.uName"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="性别:">
   											 <el-radio v-model="form.uSex" label="1">男</el-radio>
  											 <el-radio v-model="form.uSex" label="2">女</el-radio>
									</el-form-item>
								</el-col>
							</el-row>
						<el-row style="margin-left: -75px;">
								<el-col :span="12">
									<el-form-item label="密码">
										<el-input v-model="form.uPassword"></el-input>
									</el-form-item>
								</el-col>
							<el-col :span="12">
									<el-form-item label="身份证号码">
										<el-input v-model="form.u_IDcard"></el-input>
									</el-form-item>
								</el-col>
						</el-row>
							<el-row style="margin-left: -75px;">
							<el-col :span="12">
									<el-form-item label="手机号">
										<el-input v-model="form.uPhone"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="状态">
   											 <el-radio v-model="form.uSex" label="1367">在职</el-radio>
  											 <el-radio v-model="form.uSex" label="1368">离职</el-radio>
									</el-form-item>
								</el-col>
							<hr style="border: 0.5px solid #EEEEEE;" />						
							<el-form-item style="float: right;margin-top: 40px;">
								<el-button @click="cancelForm('form')">取 消</el-button>
								<el-button type="primary" @click="submitForm('form')" >确定</el-button>
								<el-button @click="resetForm('form')">重置</el-button>
							</el-form-item>
						</el-form>
					</el-dialog>
					<!--这里是弹窗--end-->
				</div>
				</div>

			</div>
			<!-- 表单 -->
			<div id="app3" style="margin-left: 10px;">
					<el-table ref="multipleTable" tooltip-effect="dark" @selection-change="handleSelectionChange" :data="tableData3"
					 max-height="600" v-loading="tableloading" border style="width: 100%;color: black;"
					  element-loading-background="rgba(0, 0, 0, 0)" 
					 >
						<el-table-column type="selection" width="35">
						</el-table-column>
						<el-table-column prop="uId" label="ID">
						</el-table-column>
						<el-table-column prop="uName" label="用户名">
						</el-table-column>
						<el-table-column prop="uSex" label="性别">
						</el-table-column>
						<el-table-column prop="u_IDcard" label="身份证号码">
						</el-table-column>
						<el-table-column prop="uPhone" label="手机号">
						</el-table-column>
						<el-table-column prop="uEmail" label="邮箱">
						</el-table-column>
						<el-table-column prop="uState" label="状态">
						</el-table-column>
						<el-table-column fixed="right" label="操作" width="100">
							<template slot-scope="scope">
								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">删除</div>
									<i class="el-icon-delete" style="margin: 0px 10px;font-size: 17px;"  @click="DeleteShow(scope.row.pId)" ></i>
								</el-tooltip>
								<el-tooltip content="Bottom center" placement="bottom">
									<div slot="content">编辑</div>								
									<i class="el-icon-edit" v-on:click="loadInfo(scope.row.pId)" @click="dialogrepair = true" style="font-size: 17px;"></i>
								</el-tooltip>
							</template>
						</el-table-column>
					</el-table>
					<el-dialog title="提示" :visible.sync="dialogDelete" width="30%" >
					 	 <span>你确定要删除吗？</span>
					  	<span slot="footer" class="dialog-footer">
					    <el-button @click="dialogDelete = false">取 消</el-button>
					    <el-button type="primary" @click="dialogDelete = false" v-on:click="Delete" >确 定</el-button>
					  </span>
					</el-dialog>
					<!-- 修改产品信息 -->	
					<div style="float: right;display: block;margin-right: 20px;margin-top: -10px;">		
						<!-- 这里是弹窗--start-->		
					<el-dialog   title="修改销售机会" :visible.sync="dialogrepair" width="70%" fullscreen append-to-body style="background-color: #E5E9F2;">
						<hr style="border: 1px solid #000000;margin-top: -15px;" />
						<p style="font-size: 15px;color: #333333;margin: 20px 0px 20px 0px;font-weight: 900;">机会</p>
						<hr style="border: 0.5px solid #EEEEEE;" />
						<el-form :model="form" :rules="rules" label-width="150px" ref="form" style="height: 1000px; margin-top: 20px;" >
							<el-row style="margin-left: -75px;">
								<el-col :span="12">
									<el-form-item label="品名" prop="pName">
										<el-input v-model="form.pName"></el-input>
									</el-form-item>
								</el-col>
								<el-col :span="12">
									<el-form-item label="分类">
											<el-select v-model="form.pPcId" filterable placeholder="未选">
											<el-option v-for="item in PcIds" :key="item.value" :label="item.label" :value="item.value">
											</el-option>
											</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
								</el-col>
							</el-row>
						<el-row style="margin-left: -75px;">
								<el-col :span="12">
									<el-form-item label="价格">
										<el-input v-model="form.pPrice"></el-input>
									</el-form-item>
								</el-col>
							<el-col :span="12">
									<el-form-item label="单位">
											<el-select v-model="form.pUnit" filterable placeholder="未选">
												<el-option v-for="item in pUnits" :key="item.value" :label="item.label" :value="item.value">
											</el-select>
											<el-tooltip content="Bottom center" placement="bottom">
												<div slot="content">数据字典</div>
												<i class="el-icon-document" id="newtool"></i>
											</el-tooltip>
									</el-form-item>
							</el-col>
						</el-row>
							<el-row style="margin-left: -75px;">
							<el-col :span="12">
									<el-form-item label="成本价格">
										<el-input v-model="form.pCost"></el-input>
									</el-form-item>
								</el-col>
							<el-col :span="12">
									<el-form-item label="状态:">
   											 <el-radio v-model="form.pStatus" label="1209">正常</el-radio>
  											 <el-radio v-model="form.pStatus" label="1210">停售</el-radio>
									</el-form-item>
							</el-col>
							</el-row>
							<el-row style="margin-left: -75px;">
								<el-col :span="12">
									<el-form-item label="产品说明">
										<el-input type="textarea" :rows="2" v-model="form.pDescription">
										</el-input>
									</el-form-item>
								</el-col>								
							</el-row>
							<el-row style="margin-left: -75px;">
								<el-col :span="12">
									<el-form-item label="技术参数">
										<el-input type="textarea" :rows="2" v-model="form.pTechnology">
										</el-input>
									</el-form-item>
								</el-col>
							</el-row>
							<el-row style="margin-left: -75px;">
								<el-col :span="12">
									<el-form-item label="产品备注">
										<el-input type="textarea" :rows="2" v-model="form.pRemarks">
										</el-input>
									</el-form-item>
								</el-col>
							</el-row>
						<hr style="border: 0.5px solid #EEEEEE;" />						
							<el-form-item style="float: right;margin-top: 40px;">
								<el-button @click="cancelForm('form')">取 消</el-button>
								<el-button type="primary" @click="submitForm('form')" v-on:click="dialogrepair= false">保存</el-button>
							</el-form-item>
						</el-form>
					</el-dialog>
					<!--这里是弹窗--end-->
					</div>
					<div style="margin-top: 10px">
						<div style="display: block; float: left;margin-left: 5px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">删除</div>
								<i class="el-icon-delete" style="margin: 8px;font-size: 17px;"></i>
							</el-tooltip>
						</div>
						<!-- 分页 -->
						<div style="display: block; float: left; margin-left: 300px;">
							<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage4"
							 :page-sizes="page.pageCentent" :pager-count="5" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="page.AllpageNumber">
							</el-pagination>
						</div>
						<div style="display: block; float: right;margin-right: 15px;">
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">打印</div>
								<el-button circle size="mini"><i class="el-icon-printer" style="font-size: 17px;"></i></el-button>&nbsp;
							</el-tooltip>
							
							<el-tooltip content="Bottom center" placement="bottom">
								<div slot="content">导出Excel</div>
								<el-button circle size="mini"><i class="el-icon-tickets" style="font-size: 17px;"></i></el-button>
							</el-tooltip>
							
						</div>
					</div>
				</template>
			</div>
		</div>

		<script type="text/jscript">
				var Main1 = {
					data() {
						//检查输入是否为数字,是否为空  
					      var checkpPrice = (rule, value, callback) => {
					          setTimeout(() => {
					        	 if(value==null||value==''){
					        		 callback();
					        	 }
					            if (!Number.isInteger(value)) {
					              callback(new Error('请输入数字值'));
					            } else {
					                callback();
					            }
					          }, 1000);
					        };
					return {
						tableData3:'',
						currentPage1: 5,
						currentPage2: 5,
						currentPage3: 5,
						currentPage4: 4,
						multipleSelection: [],
						dialogrepair: false,
						dialogDelete:false,
						tableloading:false,
						options3: [{
							label: '全部数据',
				            options: [{
				            	label:'全部数据',
				            	value:''
				            }]
						}, {
							label: '产品分类',
				            options: []			
						}],
						value7: '',
						option:'',
				        obj2:null,
						form: {
							pName: '',
							pPcId: '',
							pPrice: '',
							pUnit: '',
							pCost: '',
							pStatus: '1209',
							pDescription: '',
							pTechnology: '',
							pRemarks: '',
							pId: '',
							state:1,
						},
						page:{
							pageCentent:[4, 6, 10],	
							AllpageNumber:''//${productCount}
						},
						pageNumber:1,								
						pageCententSelect:4,
						pId: '',
						PcIds: '',
						pUnits: '',
						pStatus: '',
						pdID: '',
						value8: '',
						valuecust: '',
						DId:0,
						data:'',
						flag:false,
						dialogFormVisible: false,
						rules:{
							pName:[{
								required: true, 
								message: '品名为必填项',
								trigger: 'blur'						
							}],
							pPrice:[
								{
									validator:checkpPrice, trigger: 'blur' 
								}]
						},
						 fileList:[{
							 name: '', 
							 url: ''
						}]
					}
				},
				methods: {
					
					loadInfo(id){
					 // `this` 在方法里指向当前 Vue 实例	
					 alert(id);
					 
						var _this = this;
	           			var form='';
        				form=_this.form;
					 	
					 	/*
						------------------这个是修改的时候加载产品信息
						 */	 
					 if(id!=0){
					 	axios.get("/product/findOneProduct",
			           			//参数转换
			           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
			           			//ajax请求成功的回调函数
			           			{
					 		params:{
					 			pId:id
					 		}
			           			}
			          			).then(function(response){					          				
			           			console.log("回调成功，获取了服务器端返回的值v");
			           			console.log(response.data);
			           			_this.initForm(response.data,_this,id);
		          			}).catch(function(){
				           		alert("加载产品信息出错了");
				           	});	
					}else{
						_this.initForm(" ",_this,id);
						;
					}
			},
				/*
				加载表单时的初始化
				*/
				initForm(json,_this,id){
           			var form='';
          			form=_this.form;
   				if(id!=0){
	     			form.pId=id+'';	
	     			form.pPcId=json.pPcId+'';
	     			form.pUnit=json.pUnit+'';
	     			form.pStatus=json.pStatus+'';
				  }else{
					  form.pStatus='1209';
					  form.pUnit=null;
					  form.pPcId=null;
					  form.pId=null;
				  } 
           			form.pName=_this.toString(json.pName);
           			form.pPrice=_this.toString(json.pPrice);
           			form.pPcId=_this.toString(json.pPcIdlabel);
           			form.pUnit=_this.toString(json.pUnitlabel);
           			form.pCost=_this.toString(json.pCost);	
           			form.pDescription=_this.toString(json.pDescription);
           			form.pTechnology=_this.toString(json.pTechnology);
           			form.pRemarks=_this.toString(json.pRemarks);			           		           			
				},
				//强制转换成String类型
				toString(val){
				return val==null?'':(val+'');
				},
				DeleteShow(pId){
					this.pId=pId;
					this.dialogDelete=true;
					
				},
				//删除方法
				Delete(){
					var _this=this;
				
					axios.get("/product/Delete",
		           			//参数转换
		           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
		           			//ajax请求成功的回调函数
		           			{
								params:{
									pId:_this.pId
								}
		           			}
		          			).then(function(response){					          				
		           			console.log("回调成功，获取了服务器端返回的值v");
		           			console.log(response.data);

		           			//alert(_this.count);
			           			_this.$notify({
				           	          title: '删除成功',
				           	          type: 'success',
				           	       	  duration:3000
				           	        });
			           			/*
			           			-----------------------------刷新当前表单信息
			           			*/
			           			_this.page.AllpageNumber=_this.page.AllpageNumber-1;	
								console.log("当前页: "+_this.pageNumber);
								console.log("每页默认显示的条数:"+_this.pageCententSelect);
								_this.tableloading=true;
							 	axios.get("/product/productPageable",
					           			{
					           		params: {
					          				pageNumber:_this.pageNumber,
					          				pageCentent:_this.pageCententSelect,
					          				DId:_this.DId
					          			    }
					           			}
					           			//ajax请求成功的回调函数
					          			).then(function(response){					          				
					           			console.log("回调成功，获取了服务器端返回的值v");
					           			console.log(response.data);
					     		  _this.tableData3 = response.data.product;
					     		 _this.page.AllpageNumber=response.data.productCount;
					     		 _this.tableloading=false;	
					           	}).catch(function(){
					           		alert("显示客户数据出错了");
					           	});	
							 	
		           			}).catch(function(){						           				
		           				alert("删除信息出错了");
		           			});
				},						
					//这个是新增以及修改 表单提交事件
				      submitForm(formName) {
						//alert(this.form.salStage);
									var i=" ";
						    	    var obj = {};
									var _this=this;
									//分类
						    	    if(_this.form.pPcId!=null&&_this.form.pPcId!=''){
							    	    obj = this.PcIds.find((a)=>{
								    	      return a.label ===_this.form.pPcId; 
								    	    });		
								    	   if(obj!=null){
									    	    _this.form.pPcId=obj.value;
								    	   }
						    	    }else{
						    	    	_this.form.pPcId=" ";
						    	    }  
						    	    console.log("分类:"+_this.form.pPcId);
						    	    
						    	    //单位
						    	    if(_this.form.pUnit!=null&&_this.form.pUnit!=''){
							    	    obj = this.pUnits.find((a)=>{
								    	      return a.label ===_this.form.pUnit; 
								    	    });	
								    	   if(obj!=null){
									    	    _this.form.pUnit=obj.value;	
								    	   }
						    	    }else{
						    	    	_this.form.pUnit=" ";
						    	    }
						    	    console.log("单位:"+ _this.form.pUnit);	
						    	   
				        this.$refs[formName].validate((valid) => {
				          if (valid) {
					            //alert('submit!');

			           			//console.log("log:"+Qs.stringify(this.form,{arrayFormat: 'brackets'}))		
			           			console.log(JSON.stringify(_this.form));
							 	axios.get("/product/productAdd",
					           			//参数转换
					           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})	
				           			{
				           		params:_this.form 
				           			}


					           			//json.stringify(this.form)
					           			//ajax请求成功的回调函数
					          			).then(function(response){
					           			_this.$refs[formName].resetFields();//清空数据
							           			console.log("回调成功，获取了服务器端返回的值v");
							           			console.log(response.data);	
							           			_this.dialogFormVisible=false;
							           			if(_this.form.pId==null){
								           			_this.$notify({
									           	          title: '添加成功',
									           	          type: 'success',
									           	       	  duration:3000
									           	        });
								           			_this.page.AllpageNumber=_this.page.AllpageNumber+1;
							           			}else if(_this.form.pId!=null){
								           			_this.$notify({
									           	          title: '修改成功',
									           	          type: 'success',
									           	       	  duration:3000
									           	        });
							           			}else{
							           				
							           			}
							           			
					           			/*
					           			-----------------------------刷新当前表单信息
					           			*/						           								           			
										console.log("当前页: "+_this.pageNumber);
										console.log("每页默认显示的条数:"+_this.pageCententSelect);
										console.log("当id值: "+_this.form.pId);	
										
										if(_this.pageNumber==1||_this.form.pId!=null){
											_this.tableloading=true;
										 	axios.get("/product/productPageable",
								           			{
								           		params: {
								          				pageNumber:_this.pageNumber,
								          				pageCentent:_this.pageCententSelect,
								          				DId:_this.DId
								          			    }
								           			}
								           			//ajax请求成功的回调函数
								          			).then(function(response){					          				
								           			console.log("回调成功，获取了服务器端返回的值v");
								           			console.log(response.data);	
									     		  _this.tableData3 = response.data.product;
									     		 _this.page.AllpageNumber=response.data.productCount;
									     		 _this.tableloading=false;
								           	}).catch(function(){
								           		alert("显示客户数据出错了");
								           	});												
										}


					           		//this.tableData3=response.data;					           		
					           	//	this.AllpageNumber=this.count/response.data.length;
					     		//  _this.tableData3 = response.data;					     							           					           	
					           	}).catch(function(){
					           		_this.form.customer=i;
					           		alert("新增表单提交出错了");
					           	});				        	  
				          } else {
				            console.log('error submit!!');
				            return false;
				          }
				        });
				      },
			      //这个是表单重置方法
			      resetForm(formName) {
			        this.$refs[formName].resetFields();
			      },
			    //这个是表单的取消方法
			      cancelForm(formName){
			    	  this.dialogrepair = false;
			    	  this.dialogFormVisible = false;
			    	  this.$refs[formName].clearValidate();
			      },
			      
			    //这个是列表的选择事件
					 handleSelect(item) {
					    	  var _this=this;
					    	  
					    	  console.log(item[item.length-1]);
					    	  if(item!=null){
						    		 var DId=item[item.length-1];
						    		  var i=0;
						    		  var count=new Array();
							    	  var obj=null,obj2=null;
			    					  var h=0,j=0;
									  console.log("value7:"+this.value7);
									//  console.log("DId:"+DId);
									  //这里是所选值的循环
									  item.find((c)=>{
										  console.log("c:"+c);
										 // console.log("options3:"+_this.options3);
										  console.log("options3:"+_this.options3.length);
										  
										  //下面是的循环代码是判断在同一个父类字典信息中是否存在多个选中的值
										  
										  //这里是option3列表循环
										  _this.options3.find((b)=>{ 
											  console.log("options3:"+i);
											  //这里是options所有值的循环
									    	   _this.options3[i].options.find((a)=>{	
								    		   
									    		  console.log("测试："+c);
									    			 if(a.value===c){
												    	   console.log("当前所在的options："+i);	
									    				// count++;//同一个options选中的值数
									    				 console.log("这个options存在于所选值相等的值");
									    				if(obj2==null){
									    					console.log("当前所在父类："+_this.options3[i].label);
										    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
										    				 count.push(obj2);
										    				 console.log("初始化看看是什么：value="+count[0].value+"\tcount="+count[0].count+"\tDId="+count[0].DId);
									    				}else{
									    					
									    					/*if(obj2.value==i){
									    						//obj2.count=2;
																//当同一个options的值重复时，修改对应count数组的值即+1	
																
									    						count.find((j)=>{
									    							if(j.value==i){
									    								j.count=2;
									    								j.newDId=a.value;
									    								console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count+"\tDId="+count[h].OldDId);
									    							}
									    							h++;
									    						});
									    						h=0;
									    					}else{
									    						//但不是一个同个options的值时，记录该值
										    				 obj2={value:i,count:1,OldDId:a.value,newDId:''};
											    				 count.push(obj2);
											    				 console.log("看看是什么：value="+obj2.value+"\tcount="+obj2.count+"\tDId="+obj2.OldDId);
									    					}*/
								    					var flag=count.find((j)=>{
								    						//当同一个options的值重复时，修改对应count数组的值即+1	
								    							if(j.value==i){
								    								j.count=2;
								    								j.newDId=a.value;
								    								console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count+"\tDId="+count[h].DId);
								    								return 1;
								    							}
								    							h++;
								    						});
								    						h=0;
								    						 if(flag!=null){
								    							 
								    						 }else{
											    				 obj2={value:i,count:1,OldDId:a.value,parent:_this.options3[i].label,newDId:''};
											    				 count.push(obj2);
											    				 console.log("看看是什么：value="+obj2.value+"\tcount="+obj2.count+"\tDId="+obj2.DId);
								    						 }
									    				}



														//if(count==2){
										    				/* if(_this.obj2!=null){
											    				 console.log("这个 _this.obj2的值不为空,进入所选值循环:"+_this.obj2);												    					 
												    			 var j=0;												    			
												    			 _this.value7.find((b)=>{
															    		 //console.log("obj:"+obj); 													    		 
												    				  if(b==_this.obj2){
												    					  console.log("obj2:"+_this.obj2); 										    					  
												    					  console.log("所选值在改变之前的value7:"+ _this.value7); 
												    					  //_this.value7[j]=DId;
												    					 // _this.value7.pop();
												    					 _this.value7.shift();
												    					 // _this.value7[j]=null;
												    					  console.log("所选值在改变之后的value7:"+ _this.value7); 
												    					  //_this.obj2.value=obj.value;
												    					  _this.obj2=_this.value7;												    					  
												    					  console.log("修改完value7值之后将最新所选值赋值给_this.obj2:"+_this.obj2); 												    					  
																		return null;
												    				  }//b==_this.obj2
												    				 // j++;
												    			  });*/
										    				// }
										    				 /*else{
										    					 _this.obj2=c;
											    				 console.log("这个 _this.obj2的值等于空所有要给他赋值:"+ _this.obj2);										    					 
										    					 return;
										    				 }*/																					
														//}//count==2
										    			/* else{
									    					 _this.obj2=c;
										    				 console.log("这个 _this.obj2的值等于空所有要给他赋值:"+ _this.obj2);										    					 
									    					 return;
									    				 }*/
				    				 
									    			 }//a.value===c	

									    			 
										    	    });
									    	  console.log("obj:"+obj); 
									    	// if(obj!=null){										    		 
									    		// console.log("obj1:"+obj.value); 
									    		 /*
									    		 //第二次循环，判断所选值所在的options是否等于第一次所选择所在的options
									    		 //如果相等则进入所选值数组循环
									    		 */
									    		/* if(_this.options3[i].options==_this.option){
									    			 var j=0;
									    			
									    			 _this.value7.find((b)=>{
												    		 console.log("obj:"+obj.value); 													    		 
									    				  if(b==_this.obj2.value){
									    					  console.log("obj2:"+_this.obj2.value); 										    					  
									    					  console.log("value7:"+ _this.value7[j]); 
									    					  //_this.value7[j]=DId;
									    					  //_this.value7.pop();
									    					 // _this.value7[j]=null;
									    					  console.log("value7:"+ _this.value7); 
									    					  //_this.obj2.value=obj.value;
									    				  }
									    				  j++;
									    			  });	
								    				  _this.obj2.value=DId;
							    					  console.log(" _this.obj2.value:"+_this.obj2.value); 
									    			
									    		 }else{
											    	// _this.option=_this.options3[i].options;//记录用户所选值所在的options	
												    	_this.obj2=obj;  //这里记录选值的数值
											    		 console.log("options:"+_this.options); 
											    		 console.log("obj2:"+ _this.obj2.value);										    			 
									    		 }
									    	 }*/ 
											  i++;  //这里是options的自增索引值
										  });	
										  console.log("当前所选值结束列表循环-------------------------------------");
										  i=0;//将i重新赋值为0
									  });
									  //这里我们厉遍我们记录的count数组
			    						count.find((it)=>{
										    console.log("count的当前循环次数:"+h);
										    if(it==null){
										    	return 0;
										    }
			    							//当选择的是全部数据时					    							
			    							if(it.OldDId==''){			    								
											     console.log("选择的是全部数据:"+_this.value7.length);	
				    								if(_this.value7.length>1){
													    console.log("count:"+count.length);
				    									count.splice(0,count.length-1);	
													    console.log("count:"+count.length);					    									
				    								}else{
													     console.log("第一次选择非全部数据删除全部数据:");						    									
					    								 count.splice(h,1);				    									
				    								}
			    								_this.value7.splice(0,_this.value7.length-1);
			    								return 0;

			    							}
			    							//当同一个的options出现重复值时
			    							if(it.count==2){
								    			 _this.value7.find((b)=>{
										    		// console.log("obj:"+obj.value); 													    		 
							    				  if(b==it.OldDId){
							    					  console.log("odddddd:"+j.DId);								    					  
							    					 // console.log("obj2:"+_this.obj2.value); 										    					  
												     console.log("所选值在改变之前的value7:"+ _this.value7); 
							    					  //_this.value7[j]=DId;
							    					  //_this.value7.pop();
							    					 // _this.value7[j]=null;
							    					 //arrayObj.splice(deletePos,deleteCount); //删除从指定位置deletePos开始的指定数量deleteCount的元素，数组形式返回所移除的元素
							    					_this.value7.splice(j,1);
							    					  console.log("所选值在改变之后的value7:"+ _this.value7); 
							    					  //_this.obj2.value=obj.value;
							    				  }
						    						
							    				  j++;
							    			  });
								    			 j=0;
			    								//console.log("看看count数组的值是否改变"+count[h].value+'\t'+count[h].count);
			    							}
			    							h++;
					    							
			    						});
			    						this.option=count;
						    	  }else{
						    		
						    	  }							    	  
								 	
						    	  if(item.conName!=null){
							    	  var contacts=[{con:item.label2,conlabel:item.conName}];
								        console.log("item:"+item.conName);
								        this.contacts=contacts;		
								        this.form.contact=item.conName;
					           			this.conID=item.label2;
						    	  }
							       if(item.label1!=null){
							        	  this.gdID=item.label1;
							        }
							      
							      },
							      //这里是数据筛选下来宽事件
							  visibleChange(){
							    	  if(this.flag){
							    		  this.flag=false;
							    		  this.screenQueries(); 								    		  
							    	  }else{
							    		  this.flag=true;

							    	  }
							    	  
							      },    
							      //这里是数据筛选标签删除时的事件
							  removeTag(){
							    	  var _this=this;
							    	  if(_this.value7[0]==null){
							    		  //console.log("dd:"+_this.value7+"d");
								    		_this.value7[0]='';
							    	  }
							    	//alert("tag");  

							      },
							   	  //这里是筛选查询的方法
							   	 screenQueries(){
							    	  var _this=this;
						    	  /*
						    	---------------------------------------数据筛选查询  
						    	  */
						    	  console.log("option:"+_this.option);
									var data=new Array();
						    	  _this.option.find((a)=>{
							    	  console.log("option:"+a.OldDId+"\t"+a.parent);

									    	  if(a.count==2){
									    		  data.push(a.parent);
									    		  data.push(a.newDId);
									    	  }else{
									    		  data.push(a.parent);	
									    		  data.push(a.OldDId);								    		  
									    	  } 
								    	  
							    	  });

							    	  data=''+data;
							    	  this.data=data;
							    	  console.log("data:"+data);	
							    	  _this.tableloading=true;	
											 	axios.get("/product/productPageable",
											 			{
									           		params: {
									          				pageNumber:1,
									          				pageCentent:4,
									          				DId:data
									          			    }
									           			}
									           			//ajax请求成功的回调函数
									          			).then(function(response){					          				
									           			console.log("回调成功，获取了服务器端返回的值v");
									           			console.log(response.data);
									           			
									     		  _this.tableData3 = response.data.product;
									     		 _this.page.AllpageNumber=response.data.productCount;
									     		 _this.tableloading=false;
									           	}).catch(function(){
									           		alert("筛选查询出错了");
									           	});
			      },
			      loadAll() {
					   var _this=this;
					   //AllpageNumber			   
					 	axios.get("/sales/saleAddDictionaryInfo",
				           			{
				           		params: {
				           			custName:this.customer
				          			    }
				           			}
				           			//ajax请求成功的回调函数
				          			).then(function(response){					          				
				           			console.log("回调成功，获取了服务器端返回的值v");
				           			console.log("修改:"+response.data);					           		
				           		_this.restaurants=response.data;
				           	}).catch(function(){
				           		alert("显示客户初始化数据出错了");
				           	});	//这个是数据的初始化
			          
					      },
							 //这个是显示查询的数据
							 querySearchAsync(queryString, cb) {
							    	 
							        var restaurants = this.restaurants;				       
							        var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;	
							      // alert( cb);
							        clearTimeout(this.timeout);
							        this.timeout = setTimeout(() => { 
							       	cb(this.restaurants);
							       }, 3000 * Math.random());							       
							       // cb(results);
							       // this.timeout = setTimeout(() => { cb(results);}, 3000 * Math.random());
							        console.log("queryString1:"+queryString.length);
							        if(queryString.length==0){					       
							        	this.customer=null;
							        	 this.loadAll();
								        var restaurants = this.restaurants;				       
								        var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;	
								      // alert( cb);
								        clearTimeout(this.timeout);
								        this.timeout = setTimeout(() => {
								       ;
								       	cb(this.restaurants);
								       }, 3000* Math.random());	
							        }
							      },
							    //这个是根据输入的内容筛选数据
							   createStateFilter(queryString) {
							    	  console.log("queryString2:"+queryString);
							    	  if(queryString!=null&&queryString!=" "){
							    		  this.customer=queryString;				    		  
							    	  }else{
							    		  this.customer=null; 
							    	  }					    	 
							    	  console.log("customer:"+this.customer);
							    	 // this.$options.methods.mounted();
							    	//  this.mounted();
							    	this.loadAll();
							        return (state) => {return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);};
							      },
							handleClick(row) {
								console.log(row);
							},
							handleSelectionChange(val) {
								//console.log("共:"+val);
								this.multipleSelection = val;
							},
							
					//这个是选择显示数据条数事件
					handleSizeChange(val) {
						var _this = this;
						this.tableloading=true;
						this.pageCententSelect=val;
						console.log("当前页: "+this.pageNumber);
						console.log("每页默认显示的条数:"+this.pageCententSelect);
					 	axios.get("/product/productPageable",
			           			{
			           		params: {
			          				pageNumber:this.pageNumber,
			          				pageCentent:this.pageCententSelect,
			          				DId:_this.data
			          			    }
			           			}
			           			//ajax请求成功的回调函数
			          			).then(function(response){					          				
			           			console.log("回调成功，获取了服务器端返回的值v");
			           			console.log(response.data);
			           		//this.tableData3=response.data;					           		
			           		_this.tableData3 = response.data.product;
			           		_this.page.AllpageNumber=response.data.productCount;
			     		 _this.tableloading=false;
			           	}).catch(function(){
			           		alert("显示客户数据出错了");
			           	});
					},
					//这个是翻页事件
					handleCurrentChange(val) {
						var _this = this;
						this.pageNumber=val;
						this.tableloading=true;
						console.log("当前页: "+val);
						console.log("每页默认显示的条数:"+this.pageCententSelect);
						//this.$router.push({name:'/sales/salePageable',params:{pageNumber:this.pageNumber,pageCentent:this.pageCententSelect}});
						  //post提交数据
			           	axios.get("/product/productPageable",
			           			{
			           		params: {
			          				pageNumber:this.pageNumber,
			          				pageCentent:this.pageCententSelect,
			          				DId:_this.data
			          			    }
			           			}
			           			//ajax请求成功的回调函数
			          			).then(function(response){					          				
			           			console.log("回调成功，获取了服务器端返回的值v");
			           			console.log(response.data);
			           		//this.tableData3=response.data;
			     		  _this.tableData3 = response.data.product;
			     		 _this.page.AllpageNumber=response.data.productCount;
			     		 _this.tableloading=false;	
			           	}).catch(function(){
			           		alert("分页数据出错了");
			           	});
					}
	},		
			//这里是页面初始化时加载数据的事件
			    mounted() {	
				//这里是加载对应客户信息
		    	this.loadAll();	
		    	//数据筛选下拉框，初始化为全部数据
				this.value7[0]='';
		    	/*
		    	*
		    	数据筛选下拉框加载数据,加载字典信息
		    	*/	
					var _this = this;
					var form='';
       				form=_this.form;
				 	axios.get("/product/productAddDictionaryInfo",
		           			//参数转换
		           			//Qs.stringify(this.form,{arrayFormat: 'brackets'})
		           			//ajax请求成功的回调函数
		          			).then(function(response){					          				
		           			console.log("回调成功，获取了服务器端返回的值v");
		           			console.log(response.data);
		           		_this.PcIds=response.data[0];
		           		_this.pUnits=response.data[1];
			           	//产品分类
			           	_this.options3[1].options=response.data[0];
			           	_this.options3[2].options=response.data[1];
		           	}).catch(function(){
		           		alert("0");
		           	});	
				 	
			}
		}
var Ctor = Vue.extend(Main1)
//bigbox
new Ctor().$mount('#bigbox')


		</script>
	</body>
</html>
